import { service } from '@/service'

enum Api {
  tree = 'hbsys-system/dept/deptTreeInfo',
  add = 'hbsys-system/dept',
  oneList = 'hbsys-system/dept/manageList',
  line = 'hbsys-system/sysParameter/select/infoList',
  down = 'hbsys-system/dept/manageList',
  search = 'hbsys-system/dept/deptTreeInfo',
  del = 'hbsys-system/dept/ids',
  isOpen = 'hbsys-system/dept/changeStatus'
}

export const getList = (params?: any) => {
  return service.request({
    url: Api.tree,
    method: 'GET',
    params
  })
}
export const addList = (data: any) => {
  return service.request({
    url: Api.add,
    method: 'POST',
    data
  })
}
export const editList = (id: number, data: any) => {
  return service.request({
    url: Api.add,
    method: 'PUT',
    data
  })
}
export const detailstList = (id: number) => {
  return service.request({
    url: Api.add + '/' + id,
    method: 'GET'
  })
}
export const oneList = (params?: any) => {
  return service.request({
    url: Api.oneList,
    method: 'GET',
    params
  })
}
export const lineData = (id: number) => {
  return service.request({
    url: Api.line + '/' + id,
    method: 'GET'
  })
}

// 获取问题标签
export function getQuestionTag() {
  return service.request({
    url: Api.line + '/' + 51,
    method: 'GET'
  })
}

export const getDown = (id: number) => {
  return service.request({
    url: Api.down + '/' + id,
    method: 'GET'
  })
}

export const searchList = (params?: any) => {
  return service.request({
    url: Api.search,
    method: 'GET',
    params
  })
}
export const delList = (data?: any) => {
  return service.request({
    url: Api.del,
    method: 'DELETE',
    data
  })
}
export const changeStatus = (data?: any) => {
  return service.request({
    url: Api.isOpen,
    method: 'PUT',
    data
  })
}